package com.example.mapper.pc;

import com.example.entity.dto.pc.*;
import com.example.entity.hz.MOCTA;
import com.example.entity.vo.V_CKKC;
import com.example.entity.vo.pc.PeiLiaoDan;
import com.example.entity.vo.pc.PeiLiaoDanItem;
import com.example.entity.vo.pc.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

//@DS("mes")
public interface ScheduleMapper {

    /**
     *
     * @param DB 单别
     * @param DH 单号
     * @param XH 序号
     * @return
     */
    List<PCGongDan> gongdan(@Param("TD001") String DB, @Param("TD002") String DH, @Param("TD003") String XH);

//    List<String> MOCTBListIsM(@Param("gdList") List<String> gdList, @Param("phList") List<String> phList);

    List<String> MOCTBListIsM(@Param("TA001") String TA001, @Param("TA002") String TA002, @Param("phList") List<String> phList);

    List<PPRListVo> proProcessRoute(@Param("dto") PPRListDto dto);

    // 工序级排产
    List<PCListVo> scheduleList(ScheduleDto scheduleDto);

    // 工单级排产
    List<PCListVo> scheduleListMocta(ScheduleDto scheduleDto);

    List<PCListVo> scheduleListNoPage(ScheduleDto scheduleDto);

//    Long getScheduleListTotal(@Param("param") ScheduleDto scheduleDto);

    RemainderNumsVo remainderNums(RemainderNumsDto remainderNumsDto);

    //    @DS("DSCSYS")
    UserInfoVo getUserInfo(@Param("userInfo") UserInfoDto userInfoDto);

//    SumScheduleVo sumScheduleNums(@Param("param") ScheduleDto scheduleDto);

    List<MaterialStatusVo> materialStatus(MaterialStatusDto materialStatusDto);

    List<ProductionScheduleStatusVo> getProductionScheduleStatus(ProductionStatusDto productionStatusDto);

    BalanceNumByProductIdVo getBalanceNumByProductId(BalanceNumByProductIdDto balanceNumByProductIdDto);

//    List<ProductionScheduleSumGroupbyDateVo> getProductionScheduleSumGroupbyDate(@Param("param") ScheduleDto scheduleDto);

    List<GetProcessLineVo> getProcessLine(GetProcessLineDto getProcessLineDto);

    List<PcMocty> getMoctyGROUPBYDate(@Param("TY001") String TY001, @Param("TY002") String TY002, @Param("startTime") String startTime, @Param("endTime") String endTime);

    @Select("SELECT * FROM dbo.GetDatesNotInMOCTY(#{startTime}, #{needNums}, #{lineType})")
    List<String> getAvailableDateFromMocty(String startTime, int needNums, String lineType);

    @Select("SELECT ISNULL(SUM(TY004), 0) FROM MOCTY \n" +
            "WHERE ISNULL(COMPANY, '') = '' AND TY001 = #{TY001} AND TY002 = #{TY002} AND TY019 = #{TY019}")
    BigDecimal scheduleNum(String TY001, String TY002, String TY019);

    List<PeiLiaoDanItem> peiLiaoDanList(@Param("workSingle") String workSingle, @Param("workNo") String workNo);

    PeiLiaoDan peiLiaoDan(String workSingle, String workNo);

    List<MaterialStatusVo> materialStatusShangLiaoConfrim(MaterialStatusDto materialStatusDto);

    List<V_CKKC> v_ckkc();

    List<MaterialStatusVo> materialStatusSelMachines(List<String> moctaInfoList);

    List<MaterialStatusVo> materialStatusTongShuai(MaterialStatusDto materialStatusDto);

    List<MOCTA> getNoStartMocta(@Param("list") List<String> productIdList);


//    List<ScheduleVo> test01(@Param("param") ScheduleDto scheduleDto);

//    List<ScheduleVo> test02(@Param("param") ScheduleDto scheduleDto);

//    List<MaterialStatusVo> materialStatus001(MaterialStatusDto materialStatusDto);

//    List<ScheduleVo> test03();
}
